package com.itheima.ouputStream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo02 {

    public static void main(String[] args) {
        String s = "嘿嘿嘿,周公别找我";

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("day12\\b.txt", true);
            //s.getByte()   把字符串 在计算机中存储的 字节 获取一下
            byte[] bytes = s.getBytes();
            fos.write(bytes);
            //fos.write("\r\n".getBytes());
            fos.write(13);//\r
            fos.write(10);//\n
            fos.write(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fos!=null) {//非空判断
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }


    }
}
